import { ref } from 'vue';
import type { Ref } from 'vue';

export function useState<T>(initialValue: T): [Ref<T>, (newValue: T) => void] {
  const state = ref<T>(initialValue) as Ref<T>;  // 强制转换为 Ref<T>
  const setState = (newValue: T) => {
    state.value = newValue;  // 更新 state 的值
  };
  return [state, setState];
}

